/* 
 * Author      		: Adnin Devit CF 
 * Date Created		: 31-Maret-2011 
 * Date Modified	: 6-April-2011 
 * Version			: 1.1 
 * */
package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import org.hsqldb.Table;

//import jtk.project4.fleet.domain.MaintenanceHistory;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class MaintenanceHistoryPartTableField extends GroupControl<String>{
	
	private TableField<String> partTable;
	public MaintenanceHistoryPartTableField(String bindID){
		//setTitle("header.MaintenanceHistory");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		partTable = new TableField<String>("partTable","Repair");
		//partTable.setTitle("MaintenanceHistory.header.table");
		partTable.setAutoResizeMode(AutoResizeMode.AUTOFIT);
		partTable.getSelectionValues();
		
		partTable.addColumn("label.part#","part");
		partTable.addColumn("label.name","name");
		partTable.addColumn("label.description","description");
		partTable.addColumn("label.costCenter","costCenter");
		partTable.addColumn("label.quantity","quantity");
		partTable.addColumn("label.unitCost","unitCost");
		partTable.addColumn("label.extendCost","extendCost");
		
		partTable.sort("date", SortOrder.ASCENDING);
	}
	
	private void createLayout(){
		setLayout (new FormLayout())
		.addField(partTable);	
	}
}
